import Vue from 'vue'
import VueRouter, { RouteConfig } from 'vue-router'
import Main from '@/views/Main.vue'

Vue.use(VueRouter)


const routes: Array<RouteConfig> = [
  {
    path: '/',
    redirect: '/main/goods'
  },
  {
    path: '/main',  //匹配的hash值
    name: 'main', //路由对象的id
    component: Main, //匹配成功后加载的组件
    children: [
      {path: 'goods', name: 'goods', component: () => import('@/views/main_modules/Goods.vue') },
      {path: 'evaluate', name:'evaluate', component: () => import('@/views/main_modules/Evaluate.vue')  },
      {path: 'merchant', name: 'merchant', component: () => import('@/views/main_modules/Merchant.vue')  }
    ]
  },
  {
    path: '/info',
    name: 'info',
    component: () => import('@/views/Info.vue')
  }
]

const router = new VueRouter({
  routes
})

export default router
